// 326. 3的幂

package Leetcode;

public class Solution326 {
    public boolean isPowerOfThree(int n) {
        while (n != 0 && n % 3 == 0)
            n /= 3;

        return n == 1;
    }

    public boolean isPowerOfThree2(int n) {
        return n > 0 && 1162261467 % n == 0;
    }

}
